﻿@model Model.PageTable
@{
    ViewBag.Title = "Default";
}

<html>
<head>
    <title>顾客列表</title>
    <script src="~/js/jquery-1.6.2.min.js"></script>
    <script src="/js/public_ajax.js" type="text/javascript"></script>
    <link href="/css/common.css" rel="stylesheet" type="text/css" />
    <link href="/css/UserManager.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <div class="pageTitle">
        <p><img src="/css/image/tubiao_28.png" />您的位置：<span>顾客列表</span></p>
    </div>

    <div class="queryConditionDiv">
        <div class="queryText">
            <span>姓名：</span>
            <input type="text" id="ProductName" class="textinput" />

            <span>电话：</span>
            <input type="text" id="ProductName" class="textinput" />
        </div>

        <input id="btnSearch" type="button" value="" class="queryButton" />
        <script type="text/javascript">
            function searchgo() {
                var SortId = $("SortId").value;
                var BrandId = $("BrandId").value;
                var ProductName = $("ProductName").value;
                document.location.href = "ProductManager.aspx"
                                       + "?SortId=" + SortId
                                       + "&BrandId=" + BrandId
                                       + "&ProductName=" + ProductName;
            }
        </script>
    </div>

    <div class="List_head">
        <div class="head_left"></div>
        <div class="head_bj">
            <div class="xiangxi">顾客列表</div>
            <a class="xinZeng" href="Edit"></a>
        </div>
        <div class="head_right"></div>
    </div>

    <div class="list_table">
        <table class="dataShowTable" id="tb">
            <tr>
                <th class="checkbox_head_th">
                    全选<input type="checkbox" id="checkbox_head" onchange="checkAllOrNone('tb', this)" />
                </th>
                <th>姓名</th>
                <th>编号</th>
                <th>电话</th>
                <th>操作</th>
            </tr>
            @foreach (System.Data.DataRow item in Model.DataTable.Rows)
            {
                <tr id="@("tr" + item["Id"])">
                    <td><input type="checkbox" value="@item["Id"]" /></td>
                    <td style="text-align:center">@item["Name"]</td>
                    <td style="text-align:center">@item["SerialNumber"]</td>
                    <td style="text-align:center">@item["Phone"]</td>
                    <td width="150">
                        <a href="Edit?Id=@item["Id"]">修改</a>
                        <a href="javascript:void(0)" onclick="del('OrganizationEdit.aspx' , @item["Id"])">删除</a>
                    </td>
                </tr>
            }
        </table>
        <div class="list-YeMa">
            <input type="hidden" id="IdList" />
            <input type="checkbox" id="checkbox_foot" class="checkbox_foot" onchange="checkAllOrNone('tb', this)" />

            <input type="button" id="btnBatchDelete" class="shanChuXuanZhongXiang" onclick="BatchDelete" />@*setHidValue*@
        </div>

        <div id="BOX_overlay">
            <div id="ajaxinfo"></div>
        </div>
    </div>
    <script type="text/javascript">
        $(function () {//页面加载完成执行

            var strWhere = "";
            var pageIndex = 1;


            $("#btnSearch").click(cc);
        });

        function removeAll(tableId) {//清除table已有的内容
            var tbody = document.getElementById(whichId).children[0];
            var all_children = tbody.children;
            while (all_children.length > 1) {
                tbody.removeChild(tbody.lastChild);
            }
        }

        function cc() {

            var strWhere = "";
            var pageIndex = 1;

            $.ajax({
                url: '@Url.Action("GetCustomer")',
                data: { strWhere: strWhere, pageIndex: pageIndex },
                type: "POST",
                dataType: 'text',
                success: function (data) {
                    try {
                        var pageTable = eval('(' + data + ')');
                        var TotalCount = pageTable.TotalCount;
                    } catch (err) {
                        alert(err.name + ": " + err.message);
                    }
                },
                error: function (xhr, textStatus, error) {
                    alert(error);
                }
            });
        }
    </script>
</body>
</html>
